package com.atguigu05.exer.exer2;

/**
 * ClassName: ReturnExceptionDemo
 * Package: com.atguigu05.exer
 * Description:
 *
 * @Author ZY
 * @Create 23:31
 * @Version 1.0
 */
public class ReturnExceptionDemo {
    static void methodA() throws Exception{
        try{
            System.out.println("进入方法A");//1
            throw new Exception("制造异常");//3
        }finally {
            System.out.println("用A方法的finally");//2
        }
    }

    static void methodB(){
        try{
            System.out.println("进入方法B");
            return;
        }finally {
            System.out.println("用B方法的finally");
        }
    }

    public static void main(String[] args) {
        try {
            methodA();
        }catch (Exception e){
            System.out.println(e.getMessage());
        }
        methodB();
    }
}
